// Keeping the log likelihood of a collection of objects, given a certain
// encoding that shares subtructures of the objects, and uses the chinese 
// table allocation to keep graph pointers.
// Arities use their log as their LL
// All SYMBOLS and SPECIALS are not allocated a cost for existing
// For now Integers are not charged for existence, though we may want to later

#ifndef _GRAPHDL_H_
#define _GRAPHDL_H_

#include "interpret.h"

// Return in MicroNats
inline uint64 IntegerDL(int64 i) {
  return MLn(2 + abs(i));
}

struct GraphDL {
  GraphDL(double theta, double alpha);
  void AddObject(Object * o);
  void RemoveObject(Object * o);
  bool IsReusable(Object * o);
  void AddReusableObject(Object * o);
  void RemoveReusableObject(Object * o);
  void AddDefinition(Object *o);
  void RemoveDefinition(Object *o);

  // In MicroNats
  uint64 DL() { return dl_; }

  // Private

  // Maintains all incoming link counts
  hash_map<uint64, uint32, SimpleHash<uint64> > counts_;
  // uint32 * counts_;

  uint64 total_count_;

  // A discretization of ll in micronats
  uint64 dl_;

  double theta_;
  double alpha_;
};

#endif
